"""
yield关键字将一个普通函数改造成生成器函数

Version: 0.1
Author: yuwl
Date：2023-12-12
"""



def fib(n):
	f1 = 1
	f2 = 1
	for x in range(1, n+1):
		#print('idx: ', x)
		if x == 1 or x == 2:
			print(1)
		else:
			f3 = f1 + f2
			f1 = f2
			f2 = f3
			yield f3

def main():
	for val in fib(20):
		print(val)

if __name__ == '__main__':
	main()